
-- ================================================
-- Remarks: 
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'Ivy_FeedbackUser_GetByCriteria')
	BEGIN
		DROP  Procedure  Ivy_FeedbackUser_GetByCriteria
	END

GO


CREATE PROCEDURE [Ivy_FeedbackUser_GetByCriteria]
-- =============================================
-- Author:		<Ali BALCI>
-- Create date: <22-07-2012>
-- Description:	<Ivy_FeedbackUser_GetByCriteria>
-- =============================================
-- Add the parameters for the stored procedure here
(		
				@FeedbackUserName varchar(50)=null,
				@FeedbackUserEmail varchar(50)=null,
				@RegisteredUserKey int=-1,

				@Sys_DateOfCreation datetime = NULL,
				@Sys_DateOfModification datetime = NULL,
				@Sys_CreatedByID varchar(50)= NULL,
				@Sys_ModifiedByID varchar(50) = NULL,
				@Sys_DeleteType int = NULL,
				@Sys_IsDeleted int = NULL,
				@Sys_OrganizationID int = NULL,
				@Sys_InitialPrimaryKeys varchar(max)= NULL,
				@Sys_WorkstationName varchar(50)= NULL
)

AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT OFF;
	
	SELECT	[FeedbackUserKey],
			[FeedbackUserName],
			[FeedbackUserEmail],
			[RegisteredUserKey],

			[Sys_DateOfCreation],
			[Sys_DateOfModification],
			[Sys_CreatedByID],
			[Sys_ModifiedByID],
			[Sys_DeleteType],
			[Sys_IsDeleted],
			[Sys_OrganizationID],
			[Sys_InitialPrimaryKeys],
			[Sys_WorkstationName]
	FROM	[FeedbackUser]
	WHERE		
		(
			@FeedbackUserName = ISNULL( @FeedbackUserName, [FeedbackUserName] ) AND
			@FeedbackUserEmail = ISNULL( @FeedbackUserEmail, [FeedbackUserEmail] ) AND
			@RegisteredUserKey = ISNULL( @RegisteredUserKey, [RegisteredUserKey] ) AND

			@Sys_DateOfCreation = ISNULL( @Sys_DateOfCreation, [Sys_DateOfCreation]) AND
			@Sys_DateOfModification = ISNULL( @Sys_DateOfModification, [Sys_DateOfModification] ) AND
			@Sys_CreatedByID = ISNULL( @Sys_CreatedByID, [Sys_CreatedByID] ) AND
			@Sys_ModifiedByID = ISNULL( @Sys_ModifiedByID, [Sys_ModifiedByID] ) AND
			@Sys_DeleteType = ISNULL( @Sys_DeleteType, [Sys_DeleteType] ) AND
			@Sys_IsDeleted = ISNULL( @Sys_IsDeleted, [Sys_IsDeleted]) AND
			@Sys_OrganizationID = ISNULL( @Sys_OrganizationID, [Sys_OrganizationID] ) AND
			@Sys_InitialPrimaryKeys = ISNULL( @Sys_InitialPrimaryKeys, [Sys_InitialPrimaryKeys] ) AND
			@Sys_WorkstationName = ISNULL( @Sys_WorkstationName, [Sys_WorkstationName] )
		);
	
END
GO
